<?php
/**
 * Created by PhpStorm.
 * User: frnaky
 * Date: 16-2-22
 * Time: 下午1:18
 */
class Controller_Skuinfotest extends Controller
{
    public function action_getskusinfo(){
        $i=0;
        while(1){
        $sql = "SELECT * FROM `skuinfo` limit ".$i.",100";
        $skuinfo=DB::query(Database::SELECT,$sql)
            ->execute('skusystem')
            ->as_array();

            if($skuinfo){
                $info=array();
                foreach ($skuinfo as $sku) {
                    $info['sku']            = $sku['sku'];
                    $info['cnname']         = $sku['cnname'];
                    $info['enname']         = $sku['enname'];
                    $info['logic_attr']     = $sku['logic_attr'];
                    $info['asweight']       = $sku['asweight'];
                    $info['weight']         = $sku['weight'];
                    $info['price']          = $sku['price'];
                    $info['place']          = $sku['place'];
                    $info['status']         = $sku['status'];
                    $info['skucreatetime']   = $sku['skucreatetime'];
                    $info['uptime']   = $sku['uptime'];
                    $sid = DB::insert('skus',array_keys($info))
                        ->values($info)
                        ->execute('newerp');
                    }
                }else{
                    echo '执行完成';
                    break;
                }
           $i = $i+100;
        }
        exit;
    }
}